#ifndef _UI_NUMBER_H_
#define _UI_NUMBER_H_

#include "math/vec2.h"
#include <string>
#include "graphics/graphics.h"


class Image;

namespace ui
{
class UIWidget;
// old-fashioned font-class for numbers
class UINumber
{
public:
	enum		DIGITS
	{
		DIGIT_0,
		DIGIT_1,
		DIGIT_2,
		DIGIT_3,
		DIGIT_4,
		DIGIT_5,
		DIGIT_6,
		DIGIT_7,
		DIGIT_8,
		DIGIT_9,
		DIGIT_COMMA,
		DIGIT_COLON,
		DIGIT_MINUS,
		DIGIT_END,
		DIGIT_COUNT
	};
	UINumber();
	~UINumber();

	void		Load(const std::string& File);
	void		Init(const	std::string& File, float	CoordA[], const math::Vec2& Size);
	void		Draw(int	Number, const math::Vec2& Pos, bool Comma = true, COLOR Col = 0xFFFFFFFF);
	void		Draw(int	Number, UIWidget* Box, int	Align = 0, bool Comma = true, COLOR Col = 0xFFFFFFFF);
	void		DrawScaled(int	Number, const math::Vec2& Pos, float Scale, bool Comma = true, COLOR Col = 0xFFFFFFFF);
	void		DrawScaled(int	Number, UIWidget* Box, float Scale, int	Align = 0, bool Comma = true, COLOR Col = 0xFFFFFFFF);
	int			GetDigitC(int Number, bool Comma);
	void		GetScreenSize(int Number, math::Vec2& Size, bool Comma = true);
	void		SetImage();
	const math::Vec2&	GetSize() const { return m_Size; };
	int			FillBuffer(int Number, const math::Vec2& Pos, bool Comma, Graphics::Vertex2D* pVertA, int		MaxVert, COLOR baseColor);
	int			FillScaledBuffer(int num, const math::Vec2& ScreenPos, bool Comma,  Graphics::Vertex2D* VertA, int		MaxVert, COLOR baseColor, const math::Vec2& Size);


	bool		IsTime() const { return m_IsTime; };
	void		SetTime(bool b) { m_IsTime = b; };
private:
	static const int MAX_DIGIT = 50;

	math::Vec2	m_Size;
	Image*		m_pImage;
	float		m_CoordA[DIGIT_COUNT];
	bool		m_IsTime;
};

}
#endif // _UI_NUMBER_H_